import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 用户商品专属价格
 */
@Entity('goods_user_product_price')
export class GoodsUserProductPriceEntity extends BaseEntity {
  @Column({ comment: '用户ID' })
  userId: number;

  @Index()
  @Column({ comment: '商品ID' })
  goodsId: number;

  @Column({
    comment: '专属价格',
    type: 'decimal',
    precision: 12,
    scale: 2,
  })
  specialPrice: number;

  @Column({ comment: '优先级，数值越高优先级越高', default: 0 })
  priority: number;

  @Column({ comment: '生效时间', nullable: true })
  startTime: Date;

  @Column({ comment: '失效时间', nullable: true })
  endTime: Date;

  @Column({ comment: '状态', dict: ['禁用', '启用'], default: 1 })
  status: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
